#region License
/* Copyright (c) 2011 Maksymilian Mulawa
	
Redistribution and use in source and binary forms, with or without modification, 
 * are permitted provided that the following conditions are met:

   1. Redistributions of source code must retain the above copyright notice, 
 * this list of conditions and the following disclaimer.
   2. Redistributions in binary form must reproduce the above copyright notice, 
 * this list of conditions and the following disclaimer in the documentation 
 * and/or other materials provided with the distribution.
   3. The name of the author may not be used to endorse or promote products 
 * derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY 
 * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 
 * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
 * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 
 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 
 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF 
 * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#endregion

namespace ReplicationExplorer.Repositories
{
    public class ReplicationExplorerSqlQueries
    {
        public const string sp_browsereplcmds = "sp_browsereplcmds";
        public const string sp_replmonitorhelpsubscription = "sp_replmonitorhelpsubscription";
        public const string sp_replmonitorhelppublication = "sp_replmonitorhelppublication";
        public const string sp_helpdistpublisher = "sp_helpdistpublisher";
        public const string sp_helpdistributiondb = "sp_helpdistributiondb";
        public const string sp_get_distributor = "sp_get_distributor";

        public const string SelectDistributionDatabases = @"SELECT d.name DatabaseName
                                                       , d.state_desc DatabaseState
                                                       , d.collation_name DatabaseCollation
                                                       , d.recovery_model_desc RecoveryModel
                                                       , d.is_sync_with_backup IsSyncWithBackup
                                                    FROM sys.databases d (nolock)
                                                    WHERE d.is_distributor = 1";

        public const string SelectPublicationsProperties = @"
                            SELECT allow_push
                                 , allow_pull
                                 , allow_anonymous
                                 , description
                                 , sync_method
                                 , allow_subscription_copy
                                 , allow_queued_tran
                                 , allow_initialize_from_backup
                                 , immediate_sync
                              FROM MSpublications (nolock) 
                             WHERE publication_id = @publicationId 
                               AND publisher_db = @publicationDatabase
                               AND publication = @publicationName";

    }
}